﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DMHelper.Models
{
    public class SingleSkillContainer
    {
        public BooleanField classSkill = new BooleanField();
        public BooleanField UntrainedSkill = new BooleanField();
        public BooleanField ArmorCheck = new BooleanField();

        public StringField SkillName = new StringField();
        public ReferenceNumericalField keyAbilityModifier = new ReferenceNumericalField(new NumericalField());
        public ReferenceStringField keyAbilityName = new ReferenceStringField(new StringField());
        public AdditionNumericalField totalSkill = new AdditionNumericalField();
        public NumericalField ranksBonus = new NumericalField();
        public NumericalField miscBonus = new NumericalField();
        private ReferenceNumericalField _armorPenalty = new ReferenceNumericalField(new NumericalField());
        public ReferenceNumericalField ArmorPenalty
        {
            get
            {
                if (ArmorCheck.Value)
                {
                    return _armorPenalty;
                }
                else
                {
                    return new ReferenceNumericalField(new NumericalField());
                }
            }
            set
            {
                _armorPenalty = value;
            }
        }

        public SingleSkillContainer(String Name, Boolean armorCheckPenalty, Boolean untrainSkill, AbilityContainer keyAbility, NumericalField TheArmorPenalty)
        {
            SkillName = new StringField(Name);
            ArmorCheck = new BooleanField(armorCheckPenalty);
            UntrainedSkill = new BooleanField(untrainSkill);
            keyAbilityModifier = new ReferenceNumericalField(keyAbility.abilityModifier);
            keyAbilityName = new ReferenceStringField(keyAbility.abilityName);
            ArmorPenalty = new ReferenceNumericalField(TheArmorPenalty);

            totalSkill.listeModifier.Add(keyAbilityModifier);
            totalSkill.listeModifier.Add(ArmorPenalty);
            totalSkill.listeModifier.Add(ranksBonus);
            totalSkill.listeModifier.Add(miscBonus);
        }





    }
}